Skip to content

m3scluster/m3s

Repository files navigation

mesos-m3s

Discussion Issues Chat Docs Docker Pulls

Mesos Framework to run Kubernetes (K3S)

Issues

To open an issue, please use this place: https://github.com/m3scluster/m3s/issues

Requirements

  • Apache Mesos min 1.6.0
  • Mesos with SSL and Authentication is optional
  • Persistent Storage to keep K3S data (not object storage)
  • Redis DB

Run Framework

The following environment parameters are only a example. All parameters and the default values are documented in the init.go file (real documentation will be coming later). These example assume, that we run mesos-mini.

Step 1

Run a redis server:

docker run --rm --name redis -d -p 6379:6379 redis

Step 2

M3s needs some parameters to connect to Mesos. The following serve only as an example.

export MESOS_SSL=false
export DOCKER_CNI=mini
export LOGLEVEL=DEBUG
export AUTH_USERNAME=user
export AUTH_PASSWORD=password
export VOLUME_K3S_SERVER=local_k3sserver
export K3S_TOKEN=df54383b5659b9280aa1e73e60ef78fc
export DOMAIN=.mini
export BOOTSTRAP_URL=https://raw.githubusercontent.com/AVENTER-UG/mesos-m3s/master/bootstrap/bootstrap.sh
export K3S_AGENT_LABELS=[{"key":"traefik.enable","value":"true"},{"key":"traefik.http.routers.m3s.entrypoints","value":"web"},{"key":"traefik.http.routers.m3s.service","value":"m3s-http"},{"key":"traefik.http.routers.m3s.rule","value":"HostRegexp(`example.com`, `{subdomain:[a-z]+}.example.com`)"}]

The variable K3S_AGENT_LABELS gives the possibility to create labels for Traefik or other load balancers connected to mesos. In the example given here are labels for our Traefik Provider.

Step 3

Before we launch M3s, we create in Docker in dedicated network.

docker network create --subnet 10.40.0.0/24 mini

Step 4

Now M3s can be started:

./mesos-m3s

Mesos-M3s in real Apache Mesos environments

In real mesos environments, we have to set at least the following environment variables:

export MESOS_MASTER="leader.mesos:5050"
export MESOS_USERNAME=""
export MESOS_PASSWORD=""

Also the following could be usefull.

export REDIS_SERVER="127.0.0.1:6379"
export REDIS_PASSWORD=""
export REDIS_DB="1"
export MESOS_CNI="weave"

Screenshots

Access Kubernetes Dashboard

kubectl -n kubernetes-dashboard describe secret admin-user-token | grep '^token'
kubectl proxy

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services

image_2021-05-01-15-09-30

Apache Mesos running K3S Framework

image_2021-05-01-15-10-54

Access Traefik Dashboard

kubectl port-forward $(kubectl get pods --selector "app.kubernetes.io/name=traefik" --output=name -n kube-system) -n kube-system 9000:9000

http://127.0.0.1:9000/dashboard/

image_2021-06-13-17-15-45